package com.littrabble.string;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.codec.digest.DigestUtils;

public class YuufaTest {

	public static void main(String[] args) throws Exception {
		
	    Pattern pat = Pattern.compile("^.*?(\\{.*\\}).*$");
        String reMsg = "var home = {........,{}}";
        Matcher mat = pat.matcher(reMsg);
        //String json = mat.group(1);
        while( mat.find() ) {
            System.out.println( mat.group(1) );
        }
        
		// calendar.add(Calendar.DATE, -1);

		/*
		 * // String path =
		 * "c:\\doc\\eshop\\deploy\\media.war\\bonus\\shipping_sheet\\2\\xls\\2.xls"
		 * ;
		 * 
		 * String path =
		 * "c:\\doc\\eshop\\deploy\\media.war\\bonus\\shipping_sheet\\2\\xls";
		 * 
		 * File file = new File(path); if(file.exists()) { // nothing } else {
		 * file.mkdirs(); }
		 * 
		 * byte[] bytes = "xxxx".getBytes(); //FileOutputStream out = new
		 * FileOutputStream(new File(path)); //out.write(bytes);
		 * 
		 * String t = ("000" + (new Integer("012") + 1));
		 */

//		Map map = System.getProperties();
//
//		Iterator iter = map.keySet().iterator();
//		while (iter.hasNext()) {
//			String key = (String) iter.next();
//			System.out.println(key + " ===> " + map.get(key));
//		}
//
//		Double d = new Double(224.0);
//		String i = new Integer(d.intValue()).toString();
//
//		System.out.println(i);
//
//		String name = "中文說明";
//		System.out.println(URLEncoder.encode(name, "utf-8"));
//
//		name = "%E4%B8%AD%E6%96%87%E8%AA%AA%E6%98%8E";
//		System.out.println(URLDecoder.decode(name, "utf-8"));
//
		//String test = "F123456789";
		//System.out.println(" ==== " + test.matches("^[a-zA-Z][0-9]{9}$"));
//
//		String t1 = "<>@#)(*&^%$!#_-\"/";
//		System.out.println(URLEncoder.encode(t1, "utf-8"));
//
//		System.out.println(" === " + new Double("123.234").intValue());
//
		System.out.println(DigestUtils.shaHex("000000").toUpperCase());
//
//		String d1 = "2012/12/14";
//		SimpleDateFormat df = new SimpleDateFormat("yyyy/M/d");
//		Date date = df.parse(d1);
//		System.out.println(date);
//		
//		System.out.println("%A8%67%A8%C9%BE%F7 = " + URLDecoder.decode("%A8%67%A8%C9%BE%F7","ms950"));
		
//		String str = "0000%123456%";
//		System.out.println(" ==== " + str.substring(4, str.length()));
	}
}

class A1 {
    public void setB(B1 b1) {
        b1.print();
    }
}

class B1 {
    public void print() {
        System.out.println("b1");
    }
}
